package com.xiaoma.myaudience.biz.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xiaoma.myaudience.R;

public class HotSearchAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    private List<String> mList;
    private Context mContext;

    public HotSearchAdapter(Context context, List<String> list) {
    	
        mInflater = LayoutInflater.from(context);
        mList = list;
        mContext = context;
        
    }
    
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

    @Override
    public View getView(int position, View convertView, ViewGroup viewparent) {
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.search_hot_text, null);
            ViewHolder holder = new ViewHolder();
            holder.mKeyword = (TextView) convertView
                    .findViewById(R.id.hot_search_keyword);
            convertView.setTag(holder);
        }
        
        ViewHolder holder = (ViewHolder) convertView.getTag();   
        String keyword = (String)getItem(position);
        
        holder.mKeyword.setText(keyword);
        
        return convertView;
    }

    
    private class ViewHolder {
        TextView mKeyword;
    }

}
